# pip install fastapi
# pip install uvicorn[standard]

from fastapi import FastAPI, Path, Query, Form
from fastapi.staticfiles import StaticFiles
from fastapi_offline import FastAPIOffline
import uvicorn
from lib.database import Base, engine
from api.user import user_api
from entity.user import SysUser

app: FastAPI = FastAPIOffline(
    docs_url="/docs",
    redoc_url=None,
    title="项目名称",
    version="1.0.1",
    description="项目介绍"
)

app.include_router(user_api)
#启动事件

def startup(app: FastAPI):
    async def app_start():
        Base.metadata.create_all(bind=engine)
    return app_start

app.add_event_handler("startup", startup(app))

# api路由

if __name__ == '__main__':
    uvicorn.run(
        'main:app', 
        host = '0.0.0.0', 
        port = 8088, 
        reload = True
    )
